The TWS API is a very simple yet powerful interface. The most important elements are the EClientSocket class and the EWrapper interface. One of the drawbacks of providing a "full blown" sample application such as the one discussed in this guide is that it can inevitably add more noise in the form of UI code, making it difficult to differentiate between the TWS API itself and the sample code.
The IBSamples project included with the TWS API software is a console-based application that contains the minimum functionality that any API client application might need. This application contains a main class (Sample), which instantiates an EWrapper’s implementing object (EWrapperImpl) having an instance of the EClientSocket class:
As you can see in the image above, all of the available EClientSocket methods are demonstrated within the main class testIBMethods. These functions have been intentionally commented so that you can uncomment very specific method that you testing.
On the other hand, the EWrapper’s implementation is reduced to simply printing out the data received from the TWS:
Some additional classes have been added to show different kinds of contracts (ContractSamples) and orders OrderSamples):